<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateVMembersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('v_members', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name',128)->default('')->comment('姓名');
            $table->string('phone',32)->default('')->comment('手机号');
            $table->uuid('uuid')->comment('唯一标识');
            $table->string('avatar',1024)->default('')->comment('头像地址');
            $table->tinyInteger('role_id')->default(0)->comment('角色ID，10司机，20货主，0普通员工');
            $table->tinyInteger('status')->default(1)->comment('状态，1启用，2禁用');
            $table->timestamps();
            $table->unique('uuid', 'uniq_uuid');
            $table->index('role_id', 'idx_role_id');
            $table->index('status', 'idx_status');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('v_members');
    }
}
